import request from "@/utils/http/request";

//UV计数，用户点击一次+1
export function countUV(channelCode: string) {
  return request({
    url: `common/channel/click?code=${channelCode}`,
    method: "GET",
  });
}

// 获取验证码图片
export function getCodeImg() {
  return request({
    url: "login/captchaCode",
    method: "GET",
  });
}

// 发送验证码
export function sendCode(obj: any) {
  return request({
    url: `login/sendCode`,
    method: "POST",
    params: obj,
  });
}

// 登录
export function submit(
  obj: {
    channelCode: String;
    phone: Number;
    code: String;
    grantType: String;
  },
  key: any
) {
  return request({
    url: `login/submit`,
    method: "post",
    headers: {
      "Captcha-Key": key,
      "Captcha-Code": obj.code as string,
    },
    params: obj,
  });
}

export function getUserInfo() {
  return request({
    url: "client/info",
    method: "GET",
  });
}
